package SV_PASSWD_PLAIN_HC;

public class Fixed {
    /*
     * First, create (or ask some other component for) the adequate encryptor for
     * decrypting the values in the .properties file.
     */
    StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
    encryptor.setPassword("jasypt"); // could be obtained from the web, env variable, etc
    encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256");
    encryptor.setIvGenerator(new RandomIvGenerator());

    /*
     * Create an EncryptableProperties object and load it the usual way.
     */
    Properties props = new EncryptableProperties(encryptor);
   props.load(new FileInputStream("/path/to/my/configuration.properties"));

    /*
     * To get an encrypted value, do exactly the same. Decryption will
     * be transparently performed behind the scenes.
     */
    String datasourcePassword = props.getProperty("datasource.password");
}
